package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(50); not null; unique commit:'用户名'"`
	Password string `gorm:"type:varchar(50); not null; commit:'密码'"`
}

func (u *User) Create() error {
	return DB.Create(&u).Error
}
func (u *User) GetUserByUsername() error {
	return DB.Where("username=?", u.Username).Limit(1).Find(&u).Error
}
